<?php

Raise::load('core.IRaiseComparable');

/**
 * TestCoreIRaiseComparable
 * testing unit of 'phpraise/core/IRaiseComparable.php'
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreIRaiseComparable extends RaiseTest {

    public static function testInterface(){
        self::assertInterfaceExists('IRaiseComparable');
        self::assertClassExists('MockComparable');
        self::assertClassImplements('MockComparable', 'IRaiseComparable');
        self::assertClassMethod('MockComparable', 'compareTo');
    }

    public static function testCompare(){
        $m1 = new MockComparable(5);
        $m2 = new MockComparable(20);
        self::assertType($m1->compareTo($m2), 'integer');
        self::assertStrictEqual($m1->compareTo($m2), -1);
        self::assertStrictEqual($m2->compareTo($m1), 1);
    }

}